## @package karboom.utils
# Utility functions
#
# Simple utilities to make performing operations easier
#

from __future__ import division
from math import pi

## Convert radians to degrees
#
# @param rad: Angle size in radians
#
def rad2deg(rad):
    return rad * 180/pi

## Convert degrees to radians
#
# @param deg: Angle size in degrees
#
def deg2rad(deg):
    return deg * pi/180

## Interpolate
#
# @param percent: Percentage (in float) to use
# @param start: Value to start with.
# @param end: Value to end on.
# @param accel: Accelerative exponent.
#
def interpolate(percent, start, end, accel = 1.0):
    return start if percent <= 0 else end if percent >= 1 else start + percent ** accel * (end - start)